/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

 package psexecute;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.Statement;

/**
 *
 * @author Gerratana Francesco
 */
public class ConnectSQLite {
    public static void main(String[] args)
  {
     // inizializzo
     Connection connection = null;
     ResultSet resultSet = null;
     Statement statement = null;

     try
     {
         //connetto al db
         Class.forName("org.sqlite.JDBC");
         connection = DriverManager.getConnection("jdbc:sqlite:C:\\PsExec.sqlite");
         statement = connection.createStatement();
         resultSet = statement
                 .executeQuery("SELECT comando FROM Sqlite");
         while (resultSet.next())
         {
             System.out.println("Nome Comando:" + resultSet.getString("comando"));
         }
     }
     catch (Exception e)
     {
         e.printStackTrace();
     }
     finally
     {
         try
         {
             resultSet.close();
             statement.close();
             connection.close();
         }
         catch (Exception e)
         {
             e.printStackTrace();
         }
     }
 }
    
}
